<?php
@include('include/common.inc.php');	
ini_set('session.gc_maxlifetime',90*60); 
if($_SESSION['mem_id']==''&$_GET['login']==1)
{	
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
	$user_id = $_POST['username'];
	$password = md5($_POST['password']);
	$number = $_POST['number'];
	$time = $_POST['time'] * 86400;
	if($_SESSION['rand']!=$number)
	{
		MyNotice("驗證碼不正確!", 1, "member.php");
		exit();	
	}
	$sel = "select * from $TBL_MEM where user_id ='$user_id' and password='$password'";
	$res = mysql_query($sel);
	if($row =@mysql_fetch_array($res))
	{
		
		if($rows[type]==3)
		{
			MyNotice("該賬戶已被凍結!", 2, "login.php");
		}else{
			$_SESSION['type'] = $row['type'];//查看的房客 還是房東
			$_SESSION['mem_id'] = $row['user_id'];
			MyNotice("登錄成功!", 2, "member.php");
			setcookie("Cookie", $user_id, time()+$time); /* 有效期 */ 
			exit();	
		}			
	}else{
		MyNotice("你的輸入有誤!", 2, "login.php");
		exit();			
	}
	exit();
}	
$img = $row[img];	
$smarty->assign("mem_id",$_SESSION['mem_id']);
$smarty->assign("type",$_SESSION['type']);
$smarty->assign("Cookie",$_COOKIE['Cookie']);
@include('number.php');//验证码
@include('right.php');
$smarty->display('login.html');
?>